//监测占比
import echarts from '@/components/Echarts.vue'

export const setMonitorPieOption = () => {
	return {
		title: [
			{
				text: '84%',
				x: '8%',
				y: '33%',
				textStyle: {
					fontSize: '27',
					color: '#5F5F5F',
					fontFamily: 'DINAlternate-Bold',
					foontWeight: '400'
				}
			}
		],
		legend: {
			show: true,
			data: ['监测占比'],
			right: '7%',
			top: 'center',
			icon: 'none',
			textStyle: {
				fontSize: 23,
				color: '#18184F'
			}
		},
		backgroundColor: 'transparent',
		polar: {
			radius: ['100%', '88%'],
			center: ['22.5%', '50%']
		},
		angleAxis: {
			max: 100,
			show: false,
			startAngle: 270,
			clockwise: true
		},
		radiusAxis: {
			type: 'category',
			show: true,
			axisLabel: {
				show: false
			},
			axisLine: {
				show: false
			},
			axisTick: {
				show: false
			}
		},
		series: [
			{
				name: '监测占比',
				type: 'bar',
				roundCap: true,
				barWidth: 30,
				showBackground: true,
				backgroundStyle: {
					color: 'rgba(221, 222, 236, 1)'
				},
				data: [84],
				coordinateSystem: 'polar',
				itemStyle: {
					normal: {
						color: '#234AC5'
					}
				}
			}
		]
	}
}
//设备在线率
export const setOnlinePieOption = () => {
	return {
		title: [
			{
				text: '50%',
				x: '14%',
				y: '33%',
				textStyle: {
					fontSize: '27',
					color: '#5F5F5F',
					fontFamily: 'DINAlternate-Bold',
					foontWeight: '400'
				}
			}
		],
		legend: {
			show: true,
			data: ['在线率'],
			right: '10%',
			top: 'center',
			icon: 'none',
			textStyle: {
				fontSize: 23,
				color: '#18184F'
			}
		},
		backgroundColor: 'transparent',
		polar: {
			radius: ['100%', '88%'],
			center: ['28.5%', '50%']
		},
		angleAxis: {
			max: 100,
			show: false,
			startAngle: 270,
			clockwise: true
		},
		radiusAxis: {
			type: 'category',
			show: true,
			axisLabel: {
				show: false
			},
			axisLine: {
				show: false
			},
			axisTick: {
				show: false
			}
		},
		series: [
			{
				name: '在线率',
				type: 'bar',
				roundCap: true,
				barWidth: 30,
				showBackground: true,
				backgroundStyle: {
					color: 'rgba(221, 222, 236, 1)'
				},
				data: [50],
				coordinateSystem: 'polar',
				itemStyle: {
					normal: {
						color: '#65CA65'
					}
				}
			}
		]
	}
}
//点位实时在线
interface CompanyData {
	name: string //规上企业名称
	county: string //所属区县
	commissionerPhone: string //专员联系电话
	points: string[] //点位
	offlineDays: number //离线天数
	offlineDates: string[] //离线时间
	online: boolean //是否在线
	powerConsumption: number //企业用电量
	simPhone: string //报警设备mac/sim号
}
const companyDataList: CompanyData[] = [
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	},
	{
		name: '浙江嘉恒科创有限公司',
		county: '南湖区',
		commissionerPhone: '17894939053',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E'],
		offlineDays: 5,
		offlineDates: ['2023-03-23 13:32'],
		online: false,
		powerConsumption: 100,
		simPhone: 'F00000123'
	},
	{
		name: '嘉兴钢丝厂',
		county: '南湖区',
		commissionerPhone: '18734989543',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-25 13:14'],
		online: false,
		powerConsumption: 150,
		simPhone: 'A12399444'
	},
	{
		name: '浙江佳乐科仪股份有限公司',
		county: '海盐县',
		commissionerPhone: '15674872795',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F'],
		offlineDays: 0,
		offlineDates: [],
		online: true,
		powerConsumption: 300,
		simPhone: 'A12399445'
	},
	{
		name: '海盐力源环保科技股份有限公司',
		county: '海盐县',
		commissionerPhone: '19983405432',
		points: ['点位A', '点位B', '点位C'],
		offlineDays: 3,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 200,
		simPhone: 'A12399444'
	},
	{
		name: '嘉善凯斯电子股份有限公司',
		county: '嘉善县',
		commissionerPhone: '17768479543',
		points: ['点位A', '点位B'],
		offlineDays: 12,
		offlineDates: ['2023-04-15 13:32'],
		online: false,
		powerConsumption: 130,
		simPhone: 'A12399445'
	},
	{
		name: '浙江三林五金制品有限公司',
		county: '嘉善县',
		commissionerPhone: '18732948935',
		points: ['点位A', '点位B', '点位C', '点位D', '点位E', '点位F', '点位G'],
		offlineDays: 6,
		offlineDates: ['2023-05-20 12:13'],
		online: false,
		powerConsumption: 130,
		simPhone: 'F00000123'
	},
	{
		name: '浙江超能印业有限公司',
		county: '海宁市',
		commissionerPhone: '18893823432',
		points: ['点位A', '点位B'],
		offlineDays: 2,
		offlineDates: ['2023-03-26 17:16'],
		online: false,
		powerConsumption: 230,
		simPhone: 'F00000126'
	}
]
//设定阈值
const onlineThreshold = 5
//设定柱子颜色
function getBarColor(offlineDays: number): string {
	if (offlineDays >= 5) {
		return '#FE5367' // 离线5日以上
	} else if (offlineDays > 0) {
		return '#E8C32E' // 离线
	} else {
		return '#D6D8F2' // 在线
	}
}
export function getTooltipText(data: CompanyData): string {
	if (data.offlineDays >= 5) {
		return `企业名称：${data.name}<br/>所属区县：${data.county}<br/>负责人电话: ${data.commissionerPhone}<br/>mac/sim: ${
			data.simPhone
		}<br/><span style="color: #FE5367;">连续5日离线报警时间：</span><br/><span style="color: #FE5367;">${data.offlineDates.join(', ')}</span>`
	} else if (data.offlineDays > 0) {
		return `企业名称：${data.name}<br/>所属区县：${data.county}<br/>负责人电话: ${data.commissionerPhone}<br/>mac/sim: ${data.simPhone}<br/><span style="color: #8375F6;">离线时间：${data.offlineDates[0]}</span>`
	} else {
		return `企业名称：${data.name}<br/>所属区县：${data.county}<br/>负责人电话: ${data.commissionerPhone}<br/>mac/sim: ${data.simPhone}<br/>在线`
	}
	// return (
	// 	'企业名称: ' +
	// 	data.name +
	// 	'</br>' +
	// 	'所属区县 :' +
	// 	data.county +
	// 	'</br>' +
	// 	'负责人电话: ' +
	// 	data.commissionerPhone +
	// 	'</br>' +
	// 	'mac/sim: ' +
	// 	data.simPhone +
	// 	'</br>' +
	// 	'离线时间: ' +
	// 	data.offlineDates
	// )
}

export const setOnlineBarOption = () => {
	const offlineCompanies: CompanyData[] = []
	const offline5DaysAboveCompanies: CompanyData[] = []
	const onlineCompanies: CompanyData[] = []
	for (const data of companyDataList) {
		if (!data.online) {
			if (data.offlineDays >= 5) {
				offline5DaysAboveCompanies.push(data)
			} else {
				offlineCompanies.push(data)
			}
		} else {
			onlineCompanies.push(data)
		}
	}
	// 将分类整理后的企业数组按照顺序合并
	// const mergedCompanyData = offline5DaysAboveCompanies.concat(offlineCompanies, onlineCompanies)
	const mergedCompanyData = offlineCompanies.concat(offline5DaysAboveCompanies, onlineCompanies)
	console.log(mergedCompanyData)
	return {
		dataZoom: [
			{
				type: 'inside', // 使用滑动条型的 dataZoom 组件
				show: true, // 显示滑动条
				start: 0, // 起始位置为0，即初始情况下显示前面的数据
				end: 50 // 结束位置为50，即初始情况下显示前50%的数据
			}
		],
		grid: {
			left: '1%',
			right: '2%'
		},
		// tooltip: {
		// 	trigger: 'axis',
		// 	formatter: (params: any) => {
		// 		//提示信息
		// 		if (params.length > 0) {
		// 			const dataIndex = params[0].dataIndex
		// 			return getTooltipText(companyDataList[dataIndex])
		// 		}
		// 		return ''
		// 	}
		// },
		tooltip: {
			borderColor: '#fff',
			formatter: (params: any) => {
				const dataIndex = params.dataIndex
				const data = mergedCompanyData[dataIndex]
				return getTooltipText(data)
			}
		},
		xAxis: {
			type: 'category',
			data: companyDataList.map(data => data.name),
			// axisLabel: {
			// 	interval: 0,
			// 	rotate: 45,
			// 	color: '#7E76C7' // 离线的x轴颜色
			// },
			axisLine: {
				lineStyle: {
					color: '#7E76C7' // 离线的x轴颜色
				}
			},
			axisLabel: {
				show: false
			},
			axisTick: {
				show: false
			},
			splitLine: {
				show: false
			}
		},
		yAxis: {
			type: 'value',
			axisLabel: {
				show: false
			},
			axisLine: {
				show: false
			},
			axisTick: {
				show: false
			},
			splitLine: {
				show: false
			}
		},
		series: [
			{
				type: 'bar',
				barWidth: 15,
				// data: companyDataList.map(data => ({
				// 	value: data.powerConsumption,
				// 	itemStyle: {
				// 		color: getBarColor(data.offlineDays)
				// 	}
				// }))
				data: mergedCompanyData.map(data => ({
					value: data.powerConsumption,
					itemStyle: {
						color: getBarColor(data.offlineDays),
						borderRadius: [3, 3, 0, 0]
					}
				}))
			}
		]
	}
}
